package com.demo.apply.controller;


import com.demo.apply.common.Result;
import com.demo.apply.service.ApiService;
import com.demo.apply.service.ITDApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 接口api
 *
 */
@RestController
@RequestMapping("/api")
public class ApiController {


    @Autowired
    private ApiService service;
//获取分页信息
    @RequestMapping("/getPageList")
    public Result getPageList(@RequestBody Map param){
        int pageNum = (int) param.get("page");
        int limitNum = (int) param.get("limit");
        pageNum = (pageNum-1) * limitNum ;

        param.put("page", pageNum);
        param.put("limit", limitNum);

        System.out.println(param);
        Map<String, Object> pageList = service.getPageList(param);
        return Result.ok().Data(pageList);
    }

//    获取申请类型统计结果
    @RequestMapping("/getStatistics")
    public Result getStatistics(){
        List<Integer> resultList=service.getStatistics();
        return Result.ok().Data(resultList);
    }

}
